﻿
#region Usings

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Shapes;

#endregion

namespace FasterWPF
{
    public class BorderArgs
    {
    }

    public class BorderParent : FasterWPF.IParent 
    {         
        public object Generate<T>(object chain, T args, Action<ContentControl> addUIElementsAction)
        {
            return chain;
        }

        public object Add<T>(object chain, string key, T args, Border itemToAdd)
        {
            ((Border)chain).Child = itemToAdd;
            return chain;
        }

        public void Remove(object chain, string key, Border itemToRemove)
        {
            ((Border)chain).Child = null; //remove from Window

            IComposite ic = (IComposite)(((Border)chain).GetIComposite<Border>());
            ic.RemoveFromChain(itemToRemove);
        }

        public Dictionary<string, object> RetrieveDictionary(object chain)
        {
            return ((Border)chain).GetCompositeLookupDictionary<Border>();
        }

        public List<Border> RetrieveCollection(object chain)
        {
            List<Border> lb = new List<Border>();
            foreach (var kvp in ((Border)chain).GetCompositeLookupDictionary<Border>())
            {
                lb.Add((Border)kvp.Value);
            }

            return lb;
        }
            
        public void SetSelected(object chain, Border itemToSetAsSelected)
        {
        }

        //public void GetSelected
        //    return (DataGridRow)grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem);

    }
}
